package com.wenxy.httpclient.request.session;

import org.apache.http.client.CookieStore;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.protocol.SyncBasicHttpContext;

public class Global {
	public static final String tag = "HTTP_CLIENT";
	public static final int SESSION_TIME_OUT_STATE = -999;
	public static final int JSON_FORMAT_ERROR = -888;
	private static CookieStore mCookiestore;
	private static String SESSION_ID ;
	private static HttpContext mHttpContext;
	private static Global mGloableSession = new Global();
	private Global(){}
	public static  Global getInstance(){
		if(mGloableSession == null){
			synchronized(Global.class){
				mGloableSession = new Global();
			}
		}
		return mGloableSession;
	}
	public  void setSessionId(String sessionId){
		SESSION_ID = sessionId;
	}
	public  String getSessionId(){
		return SESSION_ID;
	}
	public  void setCookie(CookieStore aCookie){
		mCookiestore = aCookie;
	}
	public  CookieStore getCookie(){
		return mCookiestore;
	}
	public HttpContext getHttpContext(){
		if(mHttpContext == null ){
			synchronized(this){
				mHttpContext = new SyncBasicHttpContext(new BasicHttpContext());
			}
		}
		return mHttpContext;
	}
}
